
function interview(name) {
    return new Promise((resolve, reject) => {
        setTimeout(() => {
            if (Math.random() > 0.5) {
                resolve('success')
            } else {
                let error = new Error('fail');
                error.name = name;
                reject(error)
            }
        }, 500);
    });
}

Promise.all([
    interview('geekbang'),
    interview('tencent')
]).then(()=>{
    console.log('smile')
}).catch((err) => {
    console.log('cry for ' + err.name);
})
